import { useState } from "react"

type TabProps = {
    title: string
}
export const Tabs = ({ tabs, onTabChange }: { tabs: TabProps[], onTabChange: (v: any, i: number) => any }) => {
    const [activeInd, setInd] = useState(0);


    return <div className="row ktab ">
        {tabs.map((v, i) => <div key={i} className={"tab " + (activeInd === i ? 'active' : '')}
            onClick={() => {
                if( activeInd === i)return
                onTabChange(v, i);
                setInd(i);
            }}>
            {v.title}
        </div>
        )}
    </div>
}